package com.huonan.utils;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.StopWatch;
import lombok.SneakyThrows;

import java.util.Date;

/**
 * @Description TODO
 * @Author lxp
 * @Date 2023/3/1 下午6:52
 * @Version V1.0
 **/
public class AppStopWatch {
    @SneakyThrows
    public static void main(String[] args) {
        // String dateStr = "2023-03-01 18:38:10";
        // Date termDate = DateUtil.parse(dateStr, "yyyy-MM-dd HH:mm:ss");
        // // long nowSencend = DateUtil.currentSeconds();
        // System.out.println(dateStr);
        // System.out.println(termDate);
        // long lTermDate = DateUtils.toSecondsSinceEpoch(termDate);
        String dateStr = "2023-03-01 20:37:10";
        Date termDate = DateUtil.parse(dateStr);
        StopWatch stopWatch = DateUtil.createStopWatch("任务名称");
        // 任务1
        stopWatch.start("任务一");
        Thread.sleep(1000);
        stopWatch.stop();
        // 任务2
        stopWatch.start("任务一");
        Thread.sleep(2000);
        stopWatch.stop();
        System.out.println(stopWatch.getTotalTimeSeconds());
        //   System.out.println(stopWatch.prettyPrint());
    }
}
